<?php

//$username = $_POST['username'];

$conn = new PDO('mysql:host=localhost:3307;dbname=php','root','root');
$conn->exec('SET NAMES UTF8');
$conn->beginTransaction();
$conn->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);
//  $conn->setAttribute(PDO::ATTR_DEFAULT_FETCH_MODE, PDO::FETCH_COLUMN);
try {
$res = $conn->prepare("delete from user where id =?");
$res->bindValue(1, 143);
//$res->execute();
//$i = 1/0;
$res = $conn->prepare("delete from user where id = ?");
//$res->bindValue(1, 142);
$res->execute([0 =>145]);

echo $res->rowCount();
echo $conn->lastInsertId();
$conn->commit();
}catch (PDOException $e){
    echo 123;
    var_dump($e->getMessage());
}
